package ge.battlecity;

import java.util.ArrayList;
import java.util.List;

import javax.websocket.RemoteEndpoint.Basic;

public class ServerThread implements Runnable {
	
	List<Basic> players = new ArrayList<>();
	
	
	public ServerThread(Basic player){
		players.add(player);
	}
	
	public void addPlayer(Basic player) {
		players.add(player);
	}
	
	@Override
	public void run() {
		int i=0;
		while(true){
			try {
				Thread.sleep(1000);
				for (Basic player : players) {
					player.sendText(""+i);
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
			i++;
		}
		
	}

}
